#define _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"
void TestSLTList1()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPrint(plist);
}

void TestSLTList2()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPushFront(&plist, 5);

	plist = NULL;
	SLTPushFront(&plist, 6);

	SLTPrint(plist);
}

void TestSLTList3()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPushFront(&plist, 5);
	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPrint(plist);
}

void TestSLTList4()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPopFront(&plist);
	SLTPrint(plist);
}

void TestSLTList5()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTNode* ret=SLTFind(&plist, 3);
	ret->data = 6;
	SLTPrint(plist);
	
}

void TestSLTList6()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTNode* ret = SLTFind(&plist, 3);
	SLTInsert(&plist, ret, 11);
	SLTPrint(plist);
}

void TestSLTList7()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTNode* ret = SLTFind(&plist, 3);
	SLTErase(&plist, ret);
	ret = NULL;
	SLTPrint(plist);
}

void TestSLTList8()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTNode* ret = SLTFind(&plist, 3);
	SLTInsertAfter(ret, 111);
	SLTPrint(plist);
}

void TestSLTList9()
{
	SLTNode* plist = NULL;
	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTNode* ret = SLTFind(&plist, 3);
	SLTEraseAfter(ret);
	SLTPrint(plist);

	//SLTDestroy(plist);
	//plist = NULL;

	SLTDestroy(&plist);
}
int main()
{
	//TestSLTList1();
	//TestSLTList2();
	//TestSLTList3();
	//TestSLTList4();
	//TestSLTList5();
	//TestSLTList6();
	//TestSLTList7();
	//TestSLTList8();
	TestSLTList9();

	return 0;
}

